#include <iostream>
using namespace std;

const long long sta = 1e9 + 7;

long long power(long long m, long long n) {
    long long result = 1;
    while (m > 0) {
        if (n & 1) {
            result = (result * m) % sta;
        }
        m = (m * m) % sta;
        n >>= 1;
    }
    return result;
}
long long calculateP(long long n, long long p, long long q) {
    long long onesbup = 2 * p * q;
    long long onesbdown = 10000;
    long long fenzi = power(onesbup, n);
    long long fenmu = power(onesbdown, n);
    long long fenmuly = power(fenmu, sta - 2);
    return (fenzi * fenmuly) % sta;
}

int main() {
    int T;
    cin >> T;

    while (T--) {
        long long n, p, q;
        cin >> n >> p >> q;
        long long result = calculateP(n, p, q);
        cout << result << endl;
    }

    return 0;
}